Hello, |
Re: Reverting Current Module to a baseline
You won't. Once you have the same number of objects in the module, then you can just reconstruct the hierarchy by ordering the objects like in the baseline, starting from the 1st object and then moving the second object after or below it, depending how it is in the source module. This may get you started:
// iterate through the baseline
for o in entire modSrc do {
int nr = o."Absolute Number"
Object oTarget = null
// match the objects in the skip lists. Key: Absolute Number Value: Object in Target Module
if (!find(skTargets, nr, oTarget)) {
// TBD, XXX: How to handle error?
// print "Not found: " nr "\n"
continue
}
if (cnt ++ == 0) {
// move the first object to the start of the module, it only needs to be on top level.
if (oTarget != first modTgt) move (oTarget, after first modTgt)
iOldLevel = 1
oLastTarget = oTarget
} else {
// move all other objects relative ...
int iSrcLevel = level o
if (iSrcLevel == iOldLevel + 1) {
// The next object has a higher level, so move the next object below the last one
move (oTarget, below oLastTarget)
} else if (iSrcLevel == iOldLevel) {
// The next object has the same level, so move the next object after the last one
move (oTarget, after oLastTarget)
} else if (iSrcLevel < iOldLevel) {
// The next object has smaller level, so we need to move after one of the last parents
// iSrcLevel < iOldLevel -> e.g. Move back from Level 3 to level 1
// Therefore we will move up parents by the difference
Object oTgtParent = oLastTarget
int i; for (i = 0; i < iOldLevel - iSrcLevel; i++) oTgtParent = parent oTgtParent
move (oTarget, after oTgtParent)
} else {
error "WTH: " (identifier oTarget) " - " (iSrcLevel) " - " iOldLevel "\n"
}
iOldLevel = iSrcLevel
oLastTarget = oTarget
}
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Reverting Current Module to a baseline
If you must-must-must revert, then I think MM has some database-file hack to remove the offending intermediate baselines and make the target one "current". -Louie |